package com.amap.utils;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.TypeReference;
import java.util.Map;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;

/**
 * @author liuyi
 * @since 2025/10/31 11:19
 */
public class BeanUtils {
    public static Map<String, String> beanToMap(Object obj) {
        return JSON.parseObject(JSON.toJSONString(obj), new TypeReference<Map<String, String>>() {
        });
    }

    public static MultiValueMap<String, Object> convertToMultiValueMap(Map<String, String> params) {
        MultiValueMap<String, Object> multiValueMap = new LinkedMultiValueMap<>();
        params.forEach(multiValueMap::add);
        return multiValueMap;
    }
}
